{% extends 'home.html' %}
{% block title %}
    <title>故障回溯</title>
{% endblock %}
<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->
{% block custom_css %}
    <link href="/static/dist/summernote.css" rel="stylesheet"/>
    <link href="/static/css/Fliter.css" rel="stylesheet" />
    <link href="/static/laydate/theme/default/laydate.css" rel="stylesheet">
    <style type="text/css">

        *{
            padding:0;
            margin:0;
            border:0;
            list-style: none;
            text-decoration: none;
        }

        .label-selected{

            min-height:38px;
            margin:10px 0;
            border:1px solid #ccc;
            background-color: #fff;
            position: relative;
        }

        .label-selected li {
            display: inline-block;
            height: 27px;
            line-height: 27px;
            font-size: .8rem;
            padding: 0 1rem;
            border: 1px solid #e6e6e6;
            border-radius: 2px;
            cursor: pointer;
            margin: 4px 2px;
            color: #666;
        }
        #labelItem{
            margin-bottom: 10px;
            display: none;
        }
        .label-item {
            border: 1px solid #e6e6e6;
            padding: 10px;
            border-radius: 0 2px 2px 0;
            position: relative;
            overflow: hidden;
            background: #fff;
        }
        .label-item li {
            display: inline-block;
            height: 27px;
            line-height: 27px;
            font-size: .8rem;
            padding: 0 1rem;
            border: 1px solid #e6e6e6;
            border-radius: 2px;
            cursor: pointer;
            margin-bottom: 5px;
            margin-left: 2px;
            color: #666;
        }
        .label-item .selected{
            color:#ccc;
        }
    </style>
{% endblock %}

{% block content %}
    <div class="modal fade" id="addtips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        添加标签
                    </h4>
                </div>
                <div class="modal-body">
                    <div class="modal-body">
                        <div class="form-group ">
                            <label class="col-md-3 control-label" style="margin-top: 7px">标签名称:</label>
                            <div class="col-sm-8">
                                <input class="form-control" id="newtips" placeholder="" type="text" value=""/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-warning" data-dismiss="modal">&nbsp取消</button>
                    <button type="submit" class="btn btn-primary " onclick="appendtips()">&nbsp确定</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->

    </div>
    <div class="page-header">
        <div class="row">
            <div class="col-sm-6">
                <h4>故障报告</h4>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12 animated fadeInRight">
            <div class="mail-box">
                <div class="mail-body">
                    <div class="form-horizontal" >
                        <a href="/findproject/" class="btn btn-indigo">返回</a>
                        <button id="edit" class="btn btn-w-m btn-warning" onclick="edit1()" type="button">编辑</button>
                        <button id="dsabedit" class="btn btn-w-m btn-warning" style="display: none" onclick="disabledit1()" type="button">取消编辑</button>
                        <button type="submit" style="display:none;" id="newsavve" class="btn btn-primary" onclick="savesumon()">保存</button>
                        <hr>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">主题：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" readonly style="background-color:transparent;border:0; " id="zhutin" value='{{ title }}'>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">处理人：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" readonly style="background-color:transparent;border:0; " id="userper" value='{{ userper }}'>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">影响：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" readonly style="background-color:transparent;border:0; " id="affect" value='{{ accfet }}'>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">时间范围：</label>
                            <div class="col-sm-10">

                                <input type="text" id="inpendtimeid" name="inpendtimeid" readonly style="background-color:transparent;border:0; " placeholder="选择时间" value="{{ datetime }}" class="form-control">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">故障分类：</label>
                            <div class="col-sm-10">
                                {% if inptabshow == 'Exchange' %}
                                    <label class="radio checkbox-inline">
                                        <input type="radio" name="raerro" checked value="Exchange"> Exchange</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="AD"> AD</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="DFS">DFS</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="DHCP"> DHCP</label>
                                {% elif inptabshow == 'AD' %}
                                    <label class="radio checkbox-inline">
                                        <input type="radio" name="raerro"  value="Exchange"> Exchange</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" checked value="AD"> AD</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="DFS">DFS</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="DHCP"> DHCP</label>
                                {% elif inptabshow == 'DFS' %}
                                    <label class="radio checkbox-inline">
                                        <input type="radio" name="raerro"  value="Exchange"> Exchange</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="AD"> AD</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" checked value="DFS">DFS</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="DHCP"> DHCP</label>
                                {% elif inptabshow == 'DHCP' %}
                                    <label class="radio checkbox-inline">
                                        <input type="radio" name="raerro"  value="Exchange"> Exchange</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" value="AD"> AD</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro"  value="DFS">DFS</label>
                                    <label class="checkbox-inline">
                                        <input  type="radio" name="raerro" checked value="DHCP"> DHCP</label>
                                {% endif %}

                            </div>
                        </div>
                        <hr>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-10 col-md-offset-1" >
                        <div class="xxxxm">
                            <div class="summernote">
                                {{ messall |safe }}
                            </div>
                        </div>
                    </div>
                </div>
                <hr>
            </div>
        </div>
    </div>

{% endblock %}

{% block custom_js %}
    <script src="/static/dist/summernote.js"></script>
    <script src="/static/dist/lang/summernote-zh-CN.js"></script>
    <script src="/static/js/Filter.js"></script>
    <script src="/static/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script>
        //执行一个laydate实例
        laydate.render({
            elem: '#inpendtimeid' //指定元素
            ,type: 'datetime'
            ,range: '到'

        });
    </script>
    <script>
        function disabledit1() {
            $('.summernote').summernote('destroy');
            document.getElementById("edit").style.display='inline';
            document.getElementById("dsabedit").style.display='none';
            document.getElementById("newsavve").style.display='none';
            document.getElementById("zhutin").style.backgroundColor='transparent';
            document.getElementById("inpendtimeid").style.backgroundColor='transparent';
            document.getElementById("userper").style.backgroundColor='transparent';
            document.getElementById("affect").style.backgroundColor='transparent';
            document.getElementById("userper").style.border='0';
            document.getElementById("affect").style.border='0';
            document.getElementById("zhutin").style.border='0';
            document.getElementById("inpendtimeid").style.border='0';
        }
        {#var edit1 = function() {#}
        {#    if('{{ userid }}'!='{{ username }}'){#}
        {#        swal("你不是文档创建人，无法编辑！！！！");#}
        {#    }#}
        {#    else {#}
        {#        $('.summernote').summernote({focus: true,#}
        {#            height: 800,#}
        {#            tabsize: 2,#}
        {#            lang: 'zh-CN'#}
        {#        });#}
        {#        document.getElementById("newsavve").style.display='inline';#}
        {#        document.getElementById("edit").style.display='none';#}
        {#        document.getElementById("dsabedit").style.display='inline';#}
        {#        $("#inpendtimeid").removeAttr("style");#}
        {#        $("#zhutin").removeAttr("style");#}
        {#        $("#userper").removeAttr("style");#}
        {#        $("#affect").removeAttr("style");#}
        {#        $("#inpendtimeid").removeAttr("readonly");#}
        {#        $("#zhutin").removeAttr("readonly");#}
        {#        $("#userper").removeAttr("readonly");#}
        {#        $("#affect").removeAttr("readonly");#}
        {##}
        {#    }#}

        var edit1 = function() {
            var texid ="{{ userid }}";
            $.ajax({
                url:{% url "userauto" %},
                type:'POST',
                dataType:'json',
                data:{'texid':texid},
                async:false,
                success:function (data) {
                    if (data['isSuccess']) {
                        $('.summernote').summernote({focus: true,
                            height: 800,
                            tabsize: 2,
                            lang: 'zh-CN'
                        });
                        document.getElementById("newsavve").style.display='inline';
                        document.getElementById("edit").style.display='none';
                        document.getElementById("dsabedit").style.display='inline';
                        $("#inpendtimeid").removeAttr("style");
                        $("#zhutin").removeAttr("style");
                        $("#userper").removeAttr("style");
                        $("#affect").removeAttr("style");
                        $("#inpendtimeid").removeAttr("readonly");
                        $("#zhutin").removeAttr("readonly");
                        $("#userper").removeAttr("readonly");
                        $("#affect").removeAttr("readonly");
                    }
                    else {
                        swal("没有权限编辑");
                    }
                }
            });
        };
    </script>
    <script>
        function savesumon() {
            var texid ="{{ textid }}";
            var titel = document.getElementById('zhutin').value;
            var userper = document.getElementById('userper').value;
            var affect = document.getElementById('affect').value;
            var inpendtimeid = document.getElementById('inpendtimeid').value;
            var tab1 = $('input[name="raerro"]:checked').val();
            var markup = $('.summernote').summernote('code');
            if(tab1 == ""){
                swal("请选择标签 ！！！！！");
            }
            else if (titel==""){
                swal("请输入主题 ！！！！！");
            }
            else if (inpendtimeid==""){
                swal("请输入时间范围 ！！！！！");
            }
            else if (affect==""){
                swal("请输入影响 ！！！！！");
            }
            else if (userper==""){
                swal("请输入处理人 ！！！！！");
            }
            else if(markup=='\n' +
                '                            '){
                swal("请输入内容！！！！！")

            }
            else {
                $('.summernote').summernote('destroy');
                $.ajax({
                    url:{% url "upmesserro" %},
                    type:'POST',
                    dataType:'json',
                    data:{'titel':titel,'tab1':tab1,'markup':markup,'userper':userper,'affect':affect,'inpendtimeid':inpendtimeid,'texid':texid},
                    async:false,
                    success:function (data) {
                        if (data['isSuccess']) {
                            swal({
                                    title:"",
                                    text:"保存成功",
                                    type:"success",
                                    showConfirmButton:"true",
                                    confirmButtonText:"好的",
                                    animation:"slide-from-top"
                                },
                                function () {
                                    location.reload()
                                })
                        }
                        else {
                            swal(data['message'])
                        }
                    }
                });
            }
        }
    </script>
{% endblock %}

<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->

